
const Koa = require('koa');

const bodyParser = require('koa-bodyparser');
const templating = require('./templating');

const isProduction = process.env.NODE_ENV === 'production';

const app = new Koa();

const controller = require('./controller');
// parse request body:
app.use(bodyParser());
// add nunjucks as view:
app.use(templating('views', {
    noCache: !isProduction,
    watch: !isProduction
}));
// add controller:
app.use(controller('./Controllers'));
app.listen(3000);
console.log('app started at port 3000...');